IndexDiscoverManager=function(){
	this.inited=false;
	this.options={};
	this.appVM=null;
}

IndexDiscoverManager.defValue={
	contentEl:"#index-discover-content",
	appVMConfig:{
		el:"#index-discover-content",
		data:{
			indexDiscover:{
				show:true,
				msxiaobingPoem:{
					show:true
				}
			},
		}
	}
}

IndexDiscoverManager.prototype.init=function(opts){
	var that=this;
	if(!this.inited){
		this.options=$.extend(true,{},IndexDiscoverManager.defValue,opts);
		this.appVM=new Vue(this.options.appVMConfig);
		that.preLoadPages();
		that.initEventListener();
		that.loadDiscoverInfo();
	}
	this.inited=true;
}

IndexDiscoverManager.prototype.loadDiscoverInfo=function(){
	var that=this;
	var appVMConfigData=this.options.appVMConfig.data;
	var url=getShiciServiceHost()+'/shici/gushiwen/discoverInfo';
	muiAjaxGetJsonData({
		url:url,
		data:{},
		callback:function(data){
			if(data.entry){
				$.extend(true,appVMConfigData.indexDiscover,data.entry);
			}
		},
	});
}

IndexDiscoverManager.prototype.initEventListener=function(){
	var that=this;
	//
	var contentEl=this.options.contentEl;
	$(contentEl).on('tap','[to-page]',function(){
		var liEle=$(this).closest('[to-page]');
		if($(liEle).is('[to-page]') && $(liEle).attr('to-page')){
			var funcVal=$(liEle).attr('to-page');
			mui.openWindow({
				url: 'pages/'+funcVal+'.html',
				id: funcVal+'.html'
			});
		}
	});
}

IndexDiscoverManager.prototype.preLoadPages=function(){
	mui.preload({
		url: 'pages/msxiaobingPoem.html',
		id: 'msxiaobingPoem.html'
	});
}